home *** CD-ROM | disk | FTP | other *** search
- (* UMS interface for Oberon-A
- ** Modified for Oberon-A Release 1.5 by Frank Copeland
- *)
-
- <* STANDARD- *>
-
- MODULE [2] ums;
-
- IMPORT SYS := SYSTEM, Kernel, Utility, Exec, Intuition;
-
- CONST
- name = "ums.library";
-
- VAR
- base * : Exec.LibraryPtr;
-
- TYPE
- (* msgs are identified by the following type *)
- NUM * = LONGINT;
-
- (* general types *)
-
- CONST
- MaxMsgs * = MAX(NUM);
- NumFields * = 128;
-
- TYPE
- APTR * = Exec.APTR;
- STRPTR* = Exec.STRPTR;
-
- oldMsg * = ARRAY 16 OF STRPTR;
- oldMsgPtr * = POINTER TO oldMsg;
-
- MsgTextFields* = ARRAY NumFields OF STRPTR;
- MessageInfo* = RECORD
- hdrLen* : LONGINT;
- txtLen* : LONGINT;
- date* : LONGINT;
- up*, dn*,
- lt*, rt* : LONGINT;
- globalStat* : SET;
- userStat* : SET;
- loginStat* : SET;
- hardLink* : LONGINT;
- softLink* : LONGINT;
- END;
-
- CONST
-
- (* enumeration of fields in an UMS-message *)
-
- msgText * = 0;
- fromName * = 1;
- fromAddr * = 2;
- toName * = 3;
- toAddr * = 4;
- msgID * = 5;
- creationDate*= 6;
- receiveDate* = 7;
- refID * = 8;
- group * = 9;
- subject * = 10;
- attributes * = 11;
- comments * = 12;
- organization*= 13;
- distribution*= 14;
- folder* = 15;
- fidoID * = 16;
- mausID * = 17;
- replyGroup * = 18;
- replyName * = 19;
- replyAddr * = 20;
- fidoText * = 32;
- errorText * = 33;
- newsreader * = 34;
-
-
- (* user status-bits *)
-
- archive * = 4; (* msg should be archived, don't delete *)
- junk * = 5; (* negative selection, inheritance suggested *)
- postPoned * = 6; (* to be read again, (but not now) *)
- selected * = 7; (* positive selection, inheritance suggested *)
- filtered * = 15; (* msg has been processed by filter,
- 'selected' and 'junk' have been properly set *)
-
- Old * = 8; (* user has already read this Message *)
- Read * = Old;
- WriteAccess * = 9; (* user may change or delete this message *)
- ReadAccess * = 10; (* user may read this message *)
- ViewAccess * = 11; (* user may read the header of this message *)
- Owner * = 12; (* user 'owns' (wrote) this message *)
-
- ProtectedUserFlags*= {WriteAccess,ReadAccess,ViewAccess,Owner};
-
- (* global status-bits *)
-
- Deleted * = 0; (* msg is really deleted *)
- Expired * = 1; (* msg has expired and may be deleted *)
- Exported * = 2; (* msg has been exported *)
- Orphan * = 3; (* msg could not be exported *)
- Link * = 4; (* within a ring of linked msgs *)
- HardLink * = 5; (* link is hardLink *)
-
- ProtectedGlobalFlags*= {Deleted,Exported,Orphan,Link,HardLink};
-
- (*** Errors ***)
-
- CONST
- ok* = 0;
- unknown* = 1;
-
- codeMissing* = 100;
- forbiddenCode*= 101;
- noWriteAccess*= 102;
- noReader* = 103;
- noExporter* = 104;
- badLink* = 105;
- noWork* = 106;
- noSysop* = 107;
- badChange* = 108;
-
- dupe* = 200;
- noReadAccess* = 201;
- noViewAccess* = 202;
- msgCorrupted* = 203;
- noHdrSpace* = 204;
- noSuchMsg* = 205;
- badName* = 206;
- badTag* = 207;
- missingTag* = 208;
- noSuchUser* = 209;
- notFound* = 210;
- autoBounce* = 211;
- msgDeleted* = 212;
- noNetAccess* = 213;
- badPattern* = 214;
- badVarname* = 215;
- fsFull* = 216;
- noMsgMem* = 217;
- missingIndex* = 218;
-
- serverTerminated*= 300;
- cantWrite* = 301;
- cantRead* = 302;
- wrongMsgPtr* = 303;
- serverNotFree*= 304;
- idCountProb* = 305;
- noLogin* = 306;
- wrongServer* = 307;
- noMem* = 308;
- wrongTask* = 309;
-
-
- (* tag-values *)
-
- typeSTRPTR = 2000H;
- typeVARPAR = 4000H;
-
-
- (** tags for WriteUMSMsg() **)
-
- (* add 'typeVARPAR' for ReadUMSMsg() *)
- (* no 'typeVARPAR' for WriteUMSMsg() *)
-
- tagMsgNum * = 1 + Utility.user;
-
- tagMsgDate * = 4 + Utility.user;
- (* don't usually use when writing! *)
- (* Using tagMsgDate with WriteUMSMsg() *)
- (* has a very special meaning. *)
- tagChainUp * = 7 + Utility.user;
- tagHardLink * = 14 + Utility.user;
- tagSoftLink * = 15 + Utility.user;
-
- tagAutoBounce * = 65 + Utility.user;
- (* when writing: *)
- (* data # 0: server returns error 'autoBounce', *)
- (* but still keeps the Msg and sends *)
- (* it to the sysops. *)
- tagHdrFill * = 66 + Utility.user;
- (* when writing: how much bytes to be reserved *)
- tagTxtFill * = 67 + Utility.user;
- (* for header and text *)
- tagNoUpdate * = 69 + Utility.user;
- (* data = 0: (default) set 'Old'-Flag when *)
- (* reading or writing *)
- (* data = 1: don't touch 'Old'-Flag *)
- tagHide * = 70 + Utility.user;
- (* for writing: *)
- (* data = 0: default *)
- (* data = 1: msg only accessible by exporters *)
- (* data = 2: msg only accessible by users *)
-
- tagMsgText * = 256 + typeSTRPTR + Utility.user;
- tagFromName * = tagMsgText + 1;
- tagFromAddr * = tagMsgText + 2;
- tagToName * = tagMsgText + 3;
- tagToAddr * = tagMsgText + 4;
- tagMsgID * = tagMsgText + 5;
- tagCreationDate * = tagMsgText + 6;
- tagReceiveDate * = tagMsgText + 7;
- tagRefID * = tagMsgText + 8;
- tagGroup * = tagMsgText + 9;
- tagSubject * = tagMsgText +10;
- tagAttributes * = tagMsgText +11;
- tagComments * = tagMsgText +12;
- tagOrganization * = tagMsgText +13;
- tagDistribution * = tagMsgText +14;
- tagFolder * = tagMsgText +15;
- tagFidoID * = tagMsgText +16;
- tagMausID * = tagMsgText +17;
- tagReplyGroup * = tagMsgText +18;
- tagReplyName * = tagMsgText +19;
- tagReplyAddr * = tagMsgText +20;
- tagFidoText * = tagMsgText +32;
- tagErrorText * = tagMsgText +33;
- tagNewsreader * = tagMsgText +34;
-
- (* tagMsgText+15 .. tagMsgText+127 are also usable as text-fields *)
-
- tagTextFields * = 513 + Utility.user;
- (* datatype: POINTER TO MsgTextFields *)
-
-
- (** tags for ReadUMSMsg() **)
-
- (* add 'typeVARPAR' for ReadUMSMsg() *)
- (* no 'typeVARPAR' for WriteUMSMsg() *)
-
- tagRMsgNum * = 1 + Utility.user;
-
- tagRHdrLength * = 2 + Utility.user + typeVARPAR;
- tagRTxtLength * = 3 + Utility.user + typeVARPAR;
- tagRMsgDate * = 4 + Utility.user + typeVARPAR;
- tagRChainUp * = 7 + Utility.user + typeVARPAR;
- tagRChainDn * = 8 + Utility.user + typeVARPAR;
- tagRChainLt * = 9 + Utility.user + typeVARPAR;
- tagRChainRt * = 10 + Utility.user + typeVARPAR;
- tagRGlobalFlags * = 11 + Utility.user + typeVARPAR;
- tagRUserFlags * = 12 + Utility.user + typeVARPAR;
- tagRLoginFlags * = 13 + Utility.user + typeVARPAR;
- tagRHardLink * = 14 + Utility.user + typeVARPAR;
- tagRSoftLink * = 15 + Utility.user + typeVARPAR;
-
- tagRDateStyle * = 64 + Utility.user;
- (* style for receiveDate when reading: *)
- (* data = 0: no receiveDate *)
- (* data = 1: emulate old-style receiveDate *)
- tagRIDStyle * = 68 + Utility.user;
- (* style for Message-ID *)
- (* data = 0: real Message-ID *)
- (* data = 1: old style dec-number *)
- tagRNoUpdate * = 69 + Utility.user;
- (* data = 0: (default) set 'Old'-Flag when *)
- (* reading or writing *)
- (* data = 1: don't touch 'Old'-Flag *)
-
- tagRMsgText * = 256 + typeSTRPTR + typeVARPAR + Utility.user;
- tagRFromName * = tagRMsgText + 1;
- tagRFromAddr * = tagRMsgText + 2;
- tagRToName * = tagRMsgText + 3;
- tagRToAddr * = tagRMsgText + 4;
- tagRMsgID * = tagRMsgText + 5;
- tagRCreationDate * = tagRMsgText + 6;
- tagRReceiveDate * = tagRMsgText + 7;
- tagRRefID * = tagRMsgText + 8;
- tagRGroup * = tagRMsgText + 9;
- tagRSubject * = tagRMsgText +10;
- tagRAttributes * = tagRMsgText +11;
- tagRComments * = tagRMsgText +12;
- tagROrganization * = tagRMsgText +13;
- tagRDistribution * = tagRMsgText +14;
- tagRFolder * = tagRMsgText +15;
- tagRFidoID * = tagRMsgText +16;
- tagRMausID * = tagRMsgText +17;
- tagRReplyGroup * = tagRMsgText +18;
- tagRReplyName * = tagRMsgText +19;
- tagRReplyAddr * = tagRMsgText +20;
- tagRFidoText * = tagRMsgText +32;
- tagRErrorText * = tagRMsgText +33;
- tagRNewsreader * = tagRMsgText +34;
-
- (* tagRMsgText+15 .. tagRMsgText+127 are also usable as text-fields *)
-
- tagRMsgInfo * = 512 + Utility.user;
- (* datatype: POINTER TO MessageInfo *)
- tagRTextFields * = tagRMsgInfo + 1;
- (* datatype: POINTER TO MsgTextFields *)
-
- tagRReadHeader * = tagRMsgInfo + 2;
- (* read all header-fields *)
- tagRReadAll * = tagRMsgInfo + 3;
- (* read all text-fields *)
-
-
- (** tags for UMSSelect() **)
-
- tagSelSet * = 1024 + Utility.user;
- (* flags to set on selected msgs *)
- tagSelUnset * = tagSelSet + 1;
- (* flags to clear *)
- tagSelWriteGlobal * = tagSelSet + 2;
- (* change global flags, not user-flags *)
- tagSelWriteLocal * = tagSelSet + 3;
- (* change login-local flags, not user-flags *)
- tagSelWriteUser * = tagSelSet + 4+typeSTRPTR;
- (* change other user's flags *)
-
- tagSelStart * = tagSelSet + 8;
- (* process only msgs AFTER this one *)
- tagSelStop * = tagSelSet + 9;
- (* process only msgs BEFORE this one *)
-
- (* the following are mutual-exclusiv *)
- (* use only one of the following operations, *)
- (* otherwise unpredictable things may happen! *)
-
- tagSelReadGlobal * = tagSelSet +10;
- (* examine global flags, not user-flags *)
- tagSelReadLocal * = tagSelSet +11;
- (* examine login-local flags, not user-flags *)
- tagSelReadUser * = tagSelSet +12+typeSTRPTR;
- (* examine other user's flags *)
- tagSelMask * = tagSelSet +16;
- (* select msgs, that's flags *)
- tagSelMatch * = tagSelSet +17;
- (* ANDed with mask equal match *)
- tagSelParent * = tagSelSet +18;
- (* examine parent's flags *)
-
- tagSelDate * = tagSelSet +19;
- (* select msgs younger than this date *)
-
- tagSelTree * = tagSelSet +20;
- (* select whole tree this msg is in *)
-
- tagSelSubTree * = tagSelSet +21;
- (* select sub-tree this msg is root of *)
-
- tagSelMsg * = tagSelSet +22;
- (* select a msg specified by number *)
-
- tagSelQuick * = tagSelSet +23;
- (* quick select enabled *)
- (* tagMsgText .. tagMsgText+127 are also allowed for selecting *)
-
-
- (** tags for UMSSearch() **)
-
- tagSearchLast * = 2048 + Utility.user;
- (* number of LAST msg not to search *)
- tagSearchQuick * = tagSearchLast+ 1;
- (* quick searches enabled *)
-
- tagSearchGlobal * = tagSearchLast+ 2;
- (* examine global flags instead of user-flags*)
- tagSearchLocal * = tagSearchLast+ 3;
- (* examine login-local flags, not user-flags *)
- tagSearchUser * = tagSearchLast+ 4+typeSTRPTR;
- (* examine other user's flags *)
- tagSearchDirection * = tagSearchLast+ 5;
- (* set search direction *)
- (* 0 = default *)
- (* 1 = forward *)
- (* -1 = backward *)
- tagSearchPattern * = tagSearchLast + 6;
- (* string in tagMsgText .. tagMsgText+127 is: *)
- (* 0: no pattern, just a plain string *)
- (* 1: an AmigaDOS style pattern *)
- (* 2: a pattern, only if it contains *)
- (* wildcards ('auto-detect patterns') *)
-
- tagSearchMask * = tagSearchLast+16;
- (* search a msg, that's flags *)
- tagSearchMatch * = tagSearchLast+17;
- (* ANDed with mask equal match *)
-
- (* tagMsgText .. tagMsgText+127 are also allowed for searching *)
-
-
- (** tags for ReadUMSConfig(), WriteUMSConfig() **)
-
- tagCfgGlobalOnly * = 3072 + Utility.user;
- (* read or write only global config, *)
- (* thus must not be combined with tagCfgUser *)
- tagCfgName * = tagCfgGlobalOnly+ 1 + typeSTRPTR;
- (* name of config var to read or write *)
- tagCfgUser * = tagCfgGlobalOnly+ 2 + typeSTRPTR;
- (* name of user to read/write locals from/to *)
-
-
- (** tags for ReadUMSConfig() **)
-
- tagCfgUserName * = tagCfgGlobalOnly+ 3 + typeSTRPTR;
- (* alias to get realname from *)
- tagCfgNextVar * = tagCfgGlobalOnly+ 4 + typeSTRPTR;
- (* get name of next var *)
-
-
- (** tags for WriteUMSConfig() **)
-
- tagCfgDump * = tagCfgGlobalOnly+16 + typeSTRPTR;
- (* write current settings to a file *)
- tagCfgData * = tagCfgGlobalOnly+17 + typeSTRPTR;
- (* data to write to specified var *)
-
-
-
- (*** functions ***)
-
- PROCEDURE Login* [base,-30]
- ( user[2] : ARRAY OF CHAR;
- passwd[3] : ARRAY OF CHAR )
- : LONGINT;
-
- PROCEDURE Logout* [base,-36]
- ( account[2] : LONGINT );
-
- PROCEDURE DumpConfig* [base,-114]
- ( account[2]: LONGINT );
-
- PROCEDURE ErrNum* [base,-120]
- ( account[2]: LONGINT )
- : INTEGER;
-
- PROCEDURE ErrTxt* [base,-126]
- ( account[2]: LONGINT )
- : STRPTR;
-
- PROCEDURE DeleteMsg* [base,-132]
- ( account[2]: LONGINT;
- MsgNum[3] : NUM )
- : BOOLEAN;
-
- PROCEDURE ChangeAttributes* [base,-138]
- ( account[2]: LONGINT;
- MsgNum[3] : NUM;
- att[4] : ARRAY OF CHAR )
- : BOOLEAN;
-
- PROCEDURE NextStatus* [base,-144]
- ( account[2]: LONGINT;
- from[3] : NUM;
- mask[4] : SET;
- status[5] : SET )
- : NUM;
-
- PROCEDURE SetStatus* [base,-162]
- ( acc[2] : LONGINT;
- MsgNum[3] : NUM;
- unset[4] : SET;
- set[5]: SET);
-
- PROCEDURE PrevStatus* [base,-168]
- ( acc[2] : LONGINT;
- from[3] : NUM;
- mask[4] : SET;
- status[5] : SET )
- : NUM;
-
- PROCEDURE SelStatus* [base,-174]
- ( acc[2] : LONGINT;
- set[3] : SET;
- unset[4] : SET;
- mask[5] : SET;
- status[6] : SET )
- : NUM;
-
- PROCEDURE SelGroup* [base,-180]
- ( acc[2] : LONGINT;
- set[3] : SET;
- unset[4] : SET;
- group[5] : ARRAY OF CHAR )
- : NUM;
-
- PROCEDURE GetStatus* [base,-186]
- ( acc[2] : LONGINT;
- MsgNum[3] : LONGINT )
- : SET;
-
- PROCEDURE FlushUMS* [base,-192] ();
-
- PROCEDURE CleanMB* [base,-198] () : INTEGER;
-
- PROCEDURE QuitUMS* [base,-204] ();
-
-
- (*** V8: ***)
-
- PROCEDURE UMSARexxQuery* [base,-210] ();
-
- (*** V9: ***)
-
- PROCEDURE ExportedMsg* [base,-234]
- ( acc[2] : LONGINT;
- num[3] : LONGINT );
-
- PROCEDURE CannotExport* [base,-240]
- ( acc[2] : LONGINT;
- num[3] : LONGINT;
- error[4] : ARRAY OF CHAR )
- : BOOLEAN;
-
- PROCEDURE LogUMS* [base,-246]
- ( acc[2] : LONGINT;
- level[4] : LONGINT;
- format[5] : ARRAY OF CHAR;
- args[6] : ARRAY OF SYS.BYTE );
-
- PROCEDURE LogUms* [base,-246]
- ( acc[2] : LONGINT;
- level[4] : LONGINT;
- format[5] : ARRAY OF CHAR;
- args[6].. : LONGINT );
-
- PROCEDURE UMSRLogin* [base,-252]
- ( server[2] : ARRAY OF CHAR;
- user[3] : ARRAY OF CHAR;
- passwd[4] : ARRAY OF CHAR )
- : LONGINT;
-
- PROCEDURE WriteUMSMsg* [base,-258]
- ( acc[2] : LONGINT;
- tagItems[3]: ARRAY OF Utility.TagItem )
- : LONGINT;
-
- PROCEDURE WriteUMSMsgTags* [base,-258]
- ( acc[2] : LONGINT;
- tagItems[3]..: Utility.Tag )
- : LONGINT;
-
- PROCEDURE ReadUMSMsg* [base,-264]
- ( acc[2] : LONGINT;
- tagItems[3]: ARRAY OF Utility.TagItem )
- : BOOLEAN;
-
- PROCEDURE ReadUMSMsgTags* [base,-264]
- ( acc[2] : LONGINT;
- tagItems[3]..: Utility.Tag )
- : LONGINT;
-
- PROCEDURE FreeUMSMsg* [base,-270]
- ( acc[2] : LONGINT;
- msgNum[3] : LONGINT );
-
- PROCEDURE UMSSelect* [base,-276]
- ( acc[2] : LONGINT;
- tagItems[3]: ARRAY OF Utility.TagItem )
- : LONGINT;
-
- PROCEDURE UMSSelectTags* [base,-276]
- ( acc[2] : LONGINT;
- tagItems[3]..: Utility.Tag )
- : LONGINT;
-
- PROCEDURE UMSSearch* [base,-282]
- ( acc[2] : LONGINT;
- tagItems[3]: ARRAY OF Utility.TagItem )
- : LONGINT;
-
- PROCEDURE UMSSearchTags* [base,-282]
- ( acc[2] : LONGINT;
- tagItems[3]..: Utility.Tag )
- : LONGINT;
-
- PROCEDURE ReadUMSConfig* [base,-288]
- ( acc[2]: LONGINT;
- tagItems[3]: ARRAY OF Utility.TagItem )
- : STRPTR;
-
- PROCEDURE ReadUMSConfigTags* [base,-288]
- ( acc[2]: LONGINT;
- tagItems[3]..: Utility.Tag )
- : STRPTR;
-
- PROCEDURE FreeUMSConfig* [base,-294]
- ( acc[2] : LONGINT;
- str[3] : STRPTR);
-
- PROCEDURE WriteUMSConfig* [base,-300]
- ( acc[2]: LONGINT;
- tagItems[3]: ARRAY OF Utility.TagItem )
- : BOOLEAN;
-
- PROCEDURE WriteUMSConfigTags* [base,-300]
- ( acc[2]: LONGINT;
- tagItems[3]..: Utility.Tag )
- : BOOLEAN;
-
- PROCEDURE PrivateServerCall* [base,-306]
- ( command[2]: LONGINT;
- arg[3] : APTR )
- : LONGINT;
-
- <*$LongVars-*>
-
- (*-----------------------------------*)
- PROCEDURE* [0] CloseLib (VAR rc : LONGINT);
-
- BEGIN
- IF base # NIL THEN Exec.CloseLibrary (base) END;
- END CloseLib;
-
- (*-----------------------------------*)
- PROCEDURE [0] OpenLib * (mustOpen : BOOLEAN);
-
- BEGIN
- IF base = NIL THEN
- base := Exec.OpenLibrary (name, 0);
- IF base # NIL THEN Kernel.SetCleanup (CloseLib)
- ELSIF mustOpen THEN HALT (100)
- END
- END
- END OpenLib;
-
- BEGIN
- base := NIL
- END ums.
-